Ext.define('SHApp.CompanyManage.CompanyInfo.GridPanel', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.menumanagegrid',
    requires: ['SHApp.CompanyManage.CompanyInfo.GridItem', 'SHApp.CompanyManage.CompanyInfo.Grid'],
    layout: { type: "border" },
    GridItem: null,
    CompanyInfo: null,
    pvalue: 0,
    initComponent: function () {
        var me = this;
        Ext.apply(this);
        this.createItem(); //初始化分页条
        this.callParent(arguments);
    },
    createItem: function () {
        var me = this;
        var GridItem = Ext.create('SHApp.CompanyManage.CompanyInfo.GridItem', { title: "企业分类", width: 220, pvalue: me.pvalue, split: true,
            region: "west"
        });
        GridItem.on("selectionchange", function (model, records) {
            var moduleID = "";
            if (records.length > 0) {
                moduleID = records[0].data.id;
                me.CompanyInfo.loadByParentID(moduleID, records[0].data.text);
            }
        });

        this.GridItem = GridItem;

        var CompanyInfo = Ext.create('SHApp.CompanyManage.CompanyInfo.Grid', {
            title: "企业管理",
            flex: 1,
            region: "center",
            pvalue: me.pvalue
        });
        CompanyInfo.on("OnAdd", function () {
            GridItem.reLoadData();
        });

        CompanyInfo.on("OnEdit", function () {
            GridItem.reLoadData();
        });

        CompanyInfo.on("OnDelete", function () {
            GridItem.reLoadData();
        });

        me.CompanyInfo = CompanyInfo;

        me.items = [me.GridItem, me.CompanyInfo];
    }
})